home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Telnet / Terminal 2.2 / Project / Sources / SendOptions.c < prev    next >
Text File  |  1992-01-17  |  2KB  |  80 lines

  1. /*
  2.     Terminal 2.2
  3.     "SendOptions.c"
  4. */
  5.  
  6. #ifdef THINK_C
  7. #include "MacHeaders"
  8. #endif
  9. #ifdef applec
  10. #pragma load ":(Objects):MacHeadersMPW"
  11. #pragma segment Options
  12. #endif
  13.  
  14. #include "Options.h"
  15. #include "Strings.h"
  16. #include "Utilities.h"
  17. #include "Text.h"
  18. #include "Main.h"
  19. #include "Procedure.h"
  20.  
  21. #define B_OK            1        /* "Ok" button */
  22. #define B_CANCEL        2        /* "Cancel" button */
  23. #define E_PROMPT        3        /* Wait after each line sent */
  24. #define E_LINE_DELAY    4        /* Delay after each line sent */
  25. #define E_CHAR_DELAY    5        /* Delay after each character sent */
  26. #define U_TITLELINE        6        /* Underline */
  27.  
  28. /* ----- TEXT file send options dialog --------------------------------- */
  29.  
  30. void SendOptions(void)
  31. {
  32.     register DialogPtr dialog;
  33.     register Byte str[256];
  34.     short number;
  35.  
  36.     CenterDialog('DLOG', DLOG_SEND);
  37.     if (!(dialog = GetNewDialog(DLOG_SEND, 0, (WindowPtr)-1L)))
  38.         return;
  39.     SetEText(dialog, E_PROMPT, Settings.prompt);
  40.     NumToString(Settings.linedelay, str);
  41.     SetEText(dialog, E_LINE_DELAY, str);
  42.     NumToString(Settings.chardelay, str);
  43.     SetEText(dialog, E_CHAR_DELAY, str);
  44.     SelIText(dialog, E_PROMPT, 0, 32767);
  45.     SetUserItem(dialog, U_TITLELINE, (ProcPtr)DrawUserLine);
  46.     ShowWindow(dialog);
  47.     do {
  48.         ModalDialog(OutlineFilter, &number);
  49.         switch(number) {
  50.             case B_OK:
  51.                 {
  52.                     long linedelay, chardelay;
  53.  
  54.                     GetEText(dialog, E_LINE_DELAY, str);
  55.                     StringToNum(str, &linedelay);
  56.                     if (linedelay < 0 || linedelay > 300) {
  57.                         SysBeep(1);
  58.                         SelIText(dialog, E_LINE_DELAY, 0, 32767);
  59.                         number = 0;
  60.                         break;
  61.                     }
  62.                     GetEText(dialog, E_CHAR_DELAY, str);
  63.                     StringToNum(str, &chardelay);
  64.                     if (chardelay < 0 || chardelay > 300) {
  65.                         SysBeep(1);
  66.                         SelIText(dialog, E_CHAR_DELAY, 0, 32767);
  67.                         number = 0;
  68.                         break;
  69.                     }
  70.                     GetEText(dialog, E_PROMPT, str);
  71.                     TextsendSetup(str, linedelay, chardelay);
  72.                 }
  73.                 break;
  74.             case B_CANCEL:
  75.                 break;
  76.         }
  77.     } while (number != B_OK && number != B_CANCEL);
  78.     DisposDialog(dialog);
  79. }
  80.